package com.yycx.module.pay.provider.controller;


import com.yycx.common.mybatis.model.ResultBody;
import com.yycx.common.springmvc.base.BaseController;
import com.yycx.module.pay.client.entity.PayInfo;
import com.yycx.module.pay.provider.service.PayInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;


/**
 * 支付信息管理
 *
 * @author flyme
 * @date 2019-06-23
 */
@RestController
@Api(tags = "支付模块-支付管理")
@RequestMapping("/pay/")
public class PayInfoController extends BaseController<PayInfoService, PayInfo> {


    @ApiOperation(value = "支付信息-列表", notes = "订单列表 ")
    @RequestMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map params) {
        return bizService.pageList(params);
    }

    @ApiOperation(value = "创建订单", notes = "创建订单")
    @PostMapping(value = "create")
    public ResultBody create(@RequestParam(required = false) Map params) {
        return bizService.createPayInfo(params);
    }

    @ApiOperation(value = "订单-删除", notes = "删除订单")
    @PostMapping(value = "remove")
    public ResultBody remove(@RequestParam(required = false) Map params) {
        return bizService.delete(params);
    }

    @ApiOperation(value = "查询订单支付结果", notes = "查询订单是否支付")
    @GetMapping(value = "checkPayState")
    public ResultBody checkPayState(@RequestParam(required = false) Map params) {
        return bizService.checkPayState(params);
    }

    @ApiOperation(value = "支付信息-详情", notes = "支付信息详情")
    @GetMapping(value = "get")
    public ResultBody get(@RequestParam(required = false) Map params) {
        return bizService.get(params);
    }
    /**
     * 导出支付信息统计
     *
     * @param params
     * @param request
     * @param response
     */
    @PostMapping(value = "export")
    public void export(@RequestParam(required = false) Map params, HttpServletRequest request, HttpServletResponse response) {
        bizService.export(params, request, response, "充值统计", "充值统计表",params.get("handlerName").toString());
    }

}
